package com.mxwl.cbg.common.model.es.role;

import com.mxwl.cbg.common.config.GameConfig;
import com.mxwl.cbg.common.model.source.role.Skills;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class ESRoleSkill {

    //剧情技能剩余技能点
    private Integer iSkiPoint;
    //打造熟练度
    private Integer iSmithski;
    //裁缝熟练度
    private Integer iSewski;
    //部门技能中临时符技能的数量
    private Integer lsf_skill_num;

    //门派技能是否受法宝\符石影响,默认是;这个数据要等到处理道具,法宝时才知道
    private Boolean mpjnyx = true;
    //师门技能（包含符石、法宝的等级加成）
    private List<Skill> school_skill = new ArrayList<>();
    //生活技能（包含符石、法宝的等级加成）
    private List<Skill> life_skill = new ArrayList<>();
    //剧情技能（包含符石、法宝的等级加成）
    private List<Skill> ju_qing_skill = new ArrayList<>();
    //师门技能（不包含符石、法宝的等级加成）
    private List<Skill> school_skill_no_bonus = new ArrayList<>();




    public void addSkill(Map<String, String> all_skills) {
        //对技能进行区分
        Map<String, String> juQingSkill = GameConfig.getJuQingSkill();
        Map<String, String> schoolSkill = GameConfig.getSchoolSkill();
        Map<String, String> lifeSkill = GameConfig.getLifeSkill();
        all_skills.forEach((key, value) -> {
            if (juQingSkill.containsKey(key)){
                ju_qing_skill.add(new Skill(Integer.valueOf(key), Integer.valueOf(value)));
            }else if (lifeSkill.containsKey(key)){
                life_skill.add(new Skill(Integer.valueOf(key), Integer.valueOf(value)));
            }else if (schoolSkill.containsKey(key)){
                school_skill.add(new Skill(Integer.valueOf(key), Integer.valueOf(value)));
            }
        });

    }

    /**
     * ES中存储技能的实体
     * 技能id,技能等级
     * 为保证效率，只存储技能id和技能等级
     */
    @Data
    @AllArgsConstructor
    public static class Skill {
        private Integer skill_id;
        private Integer skill_level;
    }
}
